import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TPloughCopy } from "../../../Message/Db/Tables/TPloughCopy";
type int = number;
//class PloughCopyConfig
    
    export  class PloughCopyConfig
    {
        constructor()
        {
            
            this._ploughMap = new Map<any, any> /* flash.utils.Dictionary */();
            if (PloughCopyConfig._instance != null) 
            {
                throw new Error("PloughCopyConfig 单例");
            }
            this.init();
            return;
        }

        public PloughCopyConfig.get ploughMap(): Map<any, any> /* flash.utils.Dictionary */
        {
            return this._ploughMap;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_plough_copy.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc1 of loc4) 
            {
                loc2 = new TPloughCopy();
                loc2.bossNum = loc1.bossNum;
                loc2.code = loc1.code;
                loc2.copyTime = loc1.copyTime;
                loc2.describe = loc1.describe;
                loc2.descStr = loc1.descStr;
                loc2.experience = loc1.experience;
                loc2.fixReward = loc1.fixReward;
                loc2.illustrate = loc1.illustrate;
                loc2.ring = loc1.ring;
                loc2.randomReward = loc1.randomReward;
                loc2.spacesId = loc1.spacesId;
                this._ploughMap[loc2.code] = loc2;
                this._copyNum = this._copyNum + 1;
            }
            return;
        }

        public getPloughInfoByCode(arg1: int): TPloughCopy
        {
            return this._ploughMap[arg1];
        }

        public getPloughConditionByCode(arg1: int): string
        {
            var loc1=this._ploughMap[arg1];
            var loc2="";
            if (loc1) 
            {
                loc2 = loc1.describe;
            }
            return loc2;
        }

        public getPloughExpReward(arg1: int): int
        {
            var loc1=this._ploughMap[arg1];
            var loc2=0;
            if (loc1) 
            {
                loc2 = loc1.experience;
            }
            return loc2;
        }

        public getPloughCopyTimeReward(arg1: int): int
        {
            var loc1=this._ploughMap[arg1];
            var loc2=0;
            if (loc1) 
            {
                loc2 = loc1.copyTime;
            }
            return loc2;
        }

        public PloughCopyConfig.get copyNum(): int
        {
            return this._copyNum;
        }

        public static get instance(): PloughCopyConfig
        {
            if (PloughCopyConfig._instance == null) 
            {
                PloughCopyConfig._instance = new PloughCopyConfig();
            }
            return PloughCopyConfig._instance;
        }

        /* internal */ /* var */_ploughMap: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_copyNum: int=0;

        /* internal */ static /* var */_instance: PloughCopyConfig;
    }
